/*Set-Up */
#delimit;
pause on;
clear;
pause;
set mem 15m;
pause;
set more off;
pause;
cd "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead";
pause;
log using JOP_revisions, replace;
pause;
use May24, clear;
pause;
save "JOP_Revisions",replace;
pause;

/*Label Key Variables*/

lab var fd_fdigdp "Stock of FDI/GDP (fd)";

lab var fdistock_gdp "Stock of FDI/GDP";

lab var  fd_lagfdistock "Lagged stock of per capita (fd)";

lab var distance_hcmchn "Distance from major market";   

lab var crisis "Years of Asian Financial Crisis";

lab var city_dum "City Dummy";

lab var  South "Southern Dummy";

lab var fd_second "% of secondary school graduates (fd)";

lab var cabinet "Number of Compatriots in Cabinet";

lab var caseofautonomy "Case of Fence-Breaking";

/*Create New Dummy using low HCMC, so HCMC does not perfectly predict Autonomy*/

generate  caseofautonomy2= caseofautonomy;

replace  caseofautonomy2= 0 if province_code==27 & year==1994;

lab var caseofautonomy2 "Case of Fence-Breaking";


lab var previoussplit "Province the Result of Separation";

lab var years_congress "Years Since Party Congress";

lab var fd_lngdpcap "Natural Log of GDP per Capita (fd)";

generate exports_cap=exports/pop_10000;

generate fd_exports=d.exports_gdp;

lab var fd_exports "Exports/GDP (fd)";

lab var pop_10000 "Population in 10000s";

lab var  fd_pop "Population in 10000s (fd)";

drop high_exports;

generate high_exports = 1 if exports_cap>454;

replace high_exports = 0 if exports_cap<=454 & exports_cap !=. ;

pause;

lab var high_exports "Province with exports over 20.3% of GDP";

generate int_FDIexport = high_export*fd_fdigdp;

pause;

lab var int_FDIexport "Interaction between FDI and High Exports";

generate FDI_exportorient= int_FDIexport;

replace FDI_exportorient =1 if int_FDIexport ==0;

pause;


/*New Variables*/

/*Creation of Net Autonomy*/


generate lag_stockaut=l.logstockautonomy;

sort year region;

by year region: egen regaut2=mean(lag_stockaut);

generate net_aut= regaut2- lag_stockaut;

tsset province_code year;

hadrilm  net_aut if year >1997;

/* Significant, so must difference*/

generate fd_netaut=d.net_aut;

lab var fd_netaut "Net Autonomy of region (fd)";

pause;

/*Creation of Infrastructure Minimum*/
factor  urban_per tel_1000 road_transport, pcf;

predict infrastructure, regress;

by province_code, sort : egen float infra_min = min(infrastructure);

lab var infra_min "Infrastructure (Year 1)";

list province infra_min if year==1997;
pause;

/*Set as Cross-Sectional Time Series Data*/
tsset province_code year;
pause;

save "JOP_Revisions",replace;

/*Models Without Dealing with Endogeneity*/
pause;

xtpcse fd_fdigdp caseofautonomy2 distance_hcmchn fd_pop fd_agr infra_min crisis if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI", replace;
pause;

xtprobit caseofautonomy2 fd_fdigdp previoussplit cabinet party_rel  infra_min if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT", replace;
pause;


/*Stage 1 Test of Endogeneity - Baseline*/
xtpcse fd_fdigdp infra_min city_dum South fd_lngdpcap if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI";
pause;

xtprobit caseofautonomy2 city_dum South infra_min fd_lngdpcap  if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT";
pause;


xtpcse fd_fdigdp fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI";
pause;

xtprobit caseofautonomy2 years_congress previoussplit cabinet party_rel infra_min if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT";
pause;



/*CDSIMEQ Baseline*/
cdsimeq( fd_fdigdp distance_hcmchn fd_pop fd_agr infra_min fd_second crisis)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min) if year<2001, instpre;
pause;

xtpcse fd_fdigdp I_caseofautonomy fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI", replace;
pause;

xtprobit caseofautonomy2 I_fd_fdigdp years_congress previoussplit cabinet party_rel infra_min if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageAUT", replace;
pause;

drop I_caseofautonomy  I_fd_fdigdp;
pause;

/*Stage2 W/Geographical Dummies*/
xtpcse fd_fdigdp fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis city_dum South if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI";
pause;

xtprobit caseofautonomy2 years_congress previoussplit cabinet party_rel infra_min  city_dum South if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT";
pause;


cdsimeq( fd_fdigdp distance_hcmchn fd_pop fd_agr infra_min fd_second crisis  city_dum South)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min  city_dum South) if year<2001, instpre;
pause;

xtpcse fd_fdigdp I_caseofautonomy fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis  city_dum South if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI";
pause;

xtprobit caseofautonomy2 I_fd_fdigdp years_congress previoussplit cabinet party_rel infra_min city_dum South if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageAUT";
pause;

drop I_caseofautonomy  I_fd_fdigdp;
pause;

/*Stage3 Diffusion*/
xtpcse fd_fdigdp fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis city_dum South if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI";
pause;

xtprobit caseofautonomy2 years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT";
pause;


cdsimeq( fd_fdigdp distance_hcmchn fd_pop fd_agr infra_min fd_second crisis  city_dum South)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min  city_dum South fd_netaut) if year<2001, instpre;
pause;

xtpcse fd_fdigdp I_caseofautonomy fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis  city_dum South if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI";
pause;

xtprobit caseofautonomy2 I_fd_fdigdp years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageAUT";
pause;

drop I_caseofautonomy  I_fd_fdigdp;
pause;

/*Stage 4 Control for Size of Economy*/
xtpcse fd_fdigdp fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis city_dum South  fd_lngdpcap if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI";
pause;

xtprobit caseofautonomy2 years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut  fd_lngdpcap if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT";
pause;


cdsimeq( fd_fdigdp distance_hcmchn fd_pop fd_agr infra_min fd_second crisis  city_dum South  fd_lngdpcap)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min  city_dum South fd_netaut  fd_lngdpcap) if year<2001, instpre;
pause;

xtpcse fd_fdigdp I_caseofautonomy fd_second distance_hcmchn fd_pop fd_agr infra_min distance_hcmchn  crisis  city_dum South  fd_lngdpcap if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI";
pause;

xtprobit caseofautonomy2 I_fd_fdigdp years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut  fd_lngdpcap if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageAUT";
pause;

mfx;
pause;

predict Prob_AUT, mu;
pause;

xtile pct_FDI =  I_fd_fdigdp, nq(99);
pause;

twoway (qfitci  Prob_AUT pct_FDI),  xtitle(Stock of FDI/GDP (Percentile - Derived from Equation 1), size(small)) ytitle(Predicted Probability of Fence-Breaking) legend(label (1 95% Confidence Interval) label ( 2 Pr(Autonomous Action))size(small));
pause;

graph save qfit, replace;

twoway (fpfitci  Prob_AUT pct_FDI), xtitle(Stock of FDI/GDP (Percentile - Derived from Equation 1), size(small)) ytitle(Predicted Probability of Fence-Breaking, size(small))  legend(label (1 95% Confidence Interval) label ( 2 Pr(Autonomous Action))size(small));
pause;

graph save probAUT, replace;


drop I_caseofautonomy  I_fd_fdigdp;
pause;

/*Stage 5 Lagged DV - Agglomeration*/
xtpcse fd_fdigdp fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis city_dum South  fd_lngdpcap fd_lagfdistock if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI", excel label;
pause;

xtprobit caseofautonomy2 years_congress previoussplit cabinet party_rel infra_min distance_hcmchn  city_dum South fd_netaut  fd_lngdpcap if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT", excel label;
pause;


cdsimeq( fd_fdigdp distance_hcmchn fd_pop fd_agr infra_min fd_second crisis  city_dum South  fd_lngdpcap fd_lagfdistock)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min  city_dum South fd_netaut  fd_lngdpcap) if year<2001, instpre;
pause;

xtpcse fd_fdigdp I_caseofautonomy fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis  city_dum South  fd_lngdpcap fd_lagfdistock if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI", excel label;
pause;

xtprobit caseofautonomy2 I_fd_fdigdp years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut  fd_lngdpcap if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageAUT", excel label;
pause;

drop I_caseofautonomy  I_fd_fdigdp;
pause;

/*Stage 6 Exports*/
xtpcse fd_fdigdp fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis city_dum South if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI_exports2", replace;
pause;

xtprobit caseofautonomy2 years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut fd_exports if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT_exports2", replace;
pause;


cdsimeq( fd_fdigdp distance_hcmchn fd_pop fd_agr infra_min fd_second crisis  city_dum South)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min  city_dum South fd_netaut  fd_exports) if year<2001, instpre;
pause;

xtpcse fd_fdigdp I_caseofautonomy fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis  city_dum South if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI_exports2", replace;
pause;

xtprobit caseofautonomy2 I_fd_fdigdp years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut fd_exports if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageAUT_exports2", replace;
pause;

drop I_caseofautonomy  I_fd_fdigdp;
pause;

/*Stage 6 ExportsInteraction*/
xtpcse fd_fdigdp fd_second distance_hcmchn  infra_min  crisis  fd_lagfdistock high_exports  if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI_exports2", label excel;
pause;

xtprobit caseofautonomy2 years_congress previoussplit cabinet party_rel infra_min  high_exports int_FDIexport if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT_exports2", label excel;
pause;


cdsimeq( fd_fdigdp distance_hcmchn  infra_min fd_second crisis  fd_lagfdistock high_exports )
( caseofautonomy2 previoussplit  party_rel years_congress infra_min high_exports int_FDIexport) if year<2001, instpre;
pause;

xtpcse fd_fdigdp I_caseofautonomy fd_second distance_hcmchn  infra_min  crisis  fd_lagfdistock high_exports  if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI_exports2", label excel;
pause;

xtprobit caseofautonomy2 I_fd_fdigdp years_congress previoussplit cabinet party_rel infra_min  high_exports int_FDIexport if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageAUT_exports2", label excel;
pause;


xi3: probit caseofautonomy2 previoussplit  party_rel years_congress infra_min distance_hcmchn city_dum 
South i.high_exports*I_fd_fdigdp if year<2001;

postgr3  I_fd_fdigdp, by(high_export);

drop I_caseofautonomy  I_fd_fdigdp;
pause;

/*Stage 7 Only Export-Oriented FDI*/
xtpcse FDI_exportorient fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis city_dum South  fd_lngdpcap if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI_export", replace;
pause;

xtprobit caseofautonomy2 years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut  fd_lngdpcap if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT_export", replace;
pause;

cdsimeq( FDI_exportorient distance_hcmchn fd_pop fd_agr infra_min fd_second crisis  city_dum South  fd_lngdpcap)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min  city_dum South fd_netaut  fd_lngdpcap) if year<2001, instpre;
pause;

xtpcse FDI_exportorient I_caseofautonomy fd_second distance_hcmchn fd_pop fd_agr infra_min distance_hcmchn  crisis  city_dum South  fd_lngdpcap if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI_export", replace;
pause;

xtprobit caseofautonomy2  I_FDI_exportorient years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut  fd_lngdpcap if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageAUT_export", replace;
pause;

drop I_caseofautonomy  I_FDI_exportorient;

/*Stage 8 Exports*/
xtpcse fd_exports fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis city_dum South  fd_lngdpcap if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageFDI_export", lab excel;
pause;

xtprobit caseofautonomy2 years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut  fd_lngdpcap if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_firststageAUT_export", lab excel;
pause;

cdsimeq( fd_exports distance_hcmchn fd_pop fd_agr infra_min fd_second crisis  city_dum South  fd_lngdpcap)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min  city_dum South fd_netaut  fd_lngdpcap) if year<2001, instpre;
pause;

xtpcse fd_exports I_caseofautonomy fd_second distance_hcmchn fd_pop fd_agr infra_min distance_hcmchn  crisis  city_dum South  fd_lngdpcap if year<2001, hetonly;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI_export", lab excel;
pause;

xtprobit caseofautonomy2  I_fd_exports years_congress previoussplit cabinet party_rel infra_min city_dum South fd_netaut  fd_lngdpcap if year<2001, pa corr(ar 1);
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageAUT_export", lab excel;
pause;

drop I_caseofautonomy I_fd_exports;



generate ln_stockaut=ln( stockautonomy+1);
pause;

lab var ln_stockaut "Natural Log of Total Autonomous Incidents in 2000";

generate ln_fdistock=ln(fdistock_gdp+1);

lab var ln_fdistock "Natural Log of Stock of FDI/GDP in 2000";
pause;

twoway  ( lfitci ln_stockaut ln_fdistock) (scatter ln_stockaut ln_fdistock if year==1996, 
msymbol(circle) mcolor(navy) msize(small) mlabel(province) mlabsize(tiny) mlabcolor(navy)), 
ytitle(Natural Log of Total Autonomous Incidents in 1996, size(small)) xtitle(Natural Log of Stock of FDI/GDP in 1996,
 size(medsmall)) legend(rows(3) size(small) position(6) label (1 "95% Confidence Interval")
 label (2 "Predicted Values") label (3 "Actual Value"));
pause;

graph save "scatter_1996";

/*LR Test*/


xtprobit caseofautonomy2 years_congress previoussplit cabinet party_rel infra_min if year<2001, pa corr(ar 1);

predict residAUT, r;

cdsimeq( fd_fdigdp distance_hcmchn fd_pop fd_agr infra_min fd_second crisis)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min ) if year<2001, instpre;
pause;

xtprobit caseofautonomy2 I_fd_fdigdp years_congress previoussplit cabinet party_rel infra_min   if year<2001;
est store A;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_AUTLR", replace;
pause;

drop I_caseofautonomy  I_fd_fdigdp;
pause;


cdsimeq( fd_fdigdp distance_hcmchn fd_pop fd_agr infra_min fd_second crisis)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min distance_hcmchn residAUT) if year<2001, instpre;
pause;

xtprobit caseofautonomy2 I_fd_fdigdp years_congress previoussplit cabinet party_rel infra_min  residAUT if year<2001;
lrtest . A, stats;
pause;

outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_AUTLR", label excel;
pause;

drop I_caseofautonomy  I_fd_fdigdp;
pause;

/*LR TEST FDI*/

xtreg fd_fdigdp fd_second distance_hcmchn fd_pop fd_agr infra_min  crisis city_dum South fd_lngdpcap if year<2001, fe;
pause;

predict yhat;

generate residFDI = fd_fdigdp-yhat;

cdsimeq( fd_fdigdp distance_hcmchn fd_pop fd_agr infra_min fd_second fd_lngdpcap)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min ) if year<2001, instpre;
pause;

xtreg fd_fdigdp I_caseofautonomy fd_second distance_hcmchn fd_pop fd_agr infra_min fd_second fd_lngdpcap  if year<2001, fe;
pause;
est store B;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI", replace;
pause;

drop I_caseofautonomy  I_fd_fdigdp;
pause;

cdsimeq( fd_fdigdp distance_hcmchn fd_pop fd_agr infra_min fd_second  fd_lngdpcap  residFDI)
(caseofautonomy2 previoussplit cabinet party_rel years_congress infra_min  ) if year<2001, instpre;
pause;

xtreg fd_fdigdp I_caseofautonomy fd_second distance_hcmchn fd_pop fd_agr infra_min fd_second  fd_lngdpcap fd_lagfdistock residFDI if year<2001, fe;
pause;
lrtest . B, stats;
pause;
outreg2 using "C:\Users\ejm5\Dropbox\HardDrive_Latitude_08142015\data\Straight Ahead\JOP_2ndstageFDI", label excel;
pause;



log close;







